package com.yanqu.road.server.manager.unioncampwar;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CrossUnionCampWarActivityGroup {
    private int centerGroupId;
    private int weekId;
    /**
     * key:centerGroupId,centerUnionCampWarGroupData的groupId
     */
    private Map<Integer, UnionCampWarActivity> campWarActivityMap = new ConcurrentHashMap<>();

    public CrossUnionCampWarActivityGroup(int centerGroupId, int weekId) {
        this.centerGroupId = centerGroupId;
        this.weekId = weekId;
    }

    public int getCenterGroupId() {
        return centerGroupId;
    }

    public UnionCampWarActivity getActivity(int groupId) {
        return campWarActivityMap.get(groupId);
    }

    public void addActivity(UnionCampWarActivity activity) {
        campWarActivityMap.put(activity.getGroupId(), activity);
    }

    public List<UnionCampWarActivity> getActivityList() {
        List<UnionCampWarActivity> activityList = new ArrayList<>(campWarActivityMap.values());
        return activityList;
    }

    public void save() {
        List<UnionCampWarActivity> activityList = new ArrayList<>(campWarActivityMap.values());
        for (UnionCampWarActivity campWarActivity : activityList) {
            campWarActivity.save();
        }
    }

}
